<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Đại học thái nguyên</title>
		<link rel="stylesheet" type="text/css" href="<?php echo ROOT_PATH?>/css/sub_style.css"/>
		<link rel="stylesheet" type="text/css" href="<?php echo ROOT_PATH?>/css/nivo-slider.css"/>
		<script type="text/javascript" src="<?php echo ROOT_PATH?>/js/jquery-1.4.2.js"></script>
		<script type="text/javascript" src="<?php echo ROOT_PATH?>/js/jquery.nivo.slider.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				var tabActived = $("#tabbed-menu .tabs li.actived");	
				var tabActivedClasses = tabActived.attr("class");
				var ulTabbeds = $("#tabbed-menu .content ul");

				for(var i = 0; i< ulTabbeds.length; i++){
				
					var ulClass = ulTabbeds.eq(i).attr("class");
					if(tabActivedClasses.indexOf(ulClass) != -1){
						ulTabbeds.eq(i).css("display","block");
						break;
					}
				}
				
				$("#tabbed-menu .tabs li").click(function(){
						
							if($(this).attr("class").indexOf("actived") == -1){
								$("#tabbed-menu .tabs li.actived").removeClass("actived");
								$(this).addClass("actived");
								$("#tabbed-menu .content ul").fadeOut(0);
								for(var i = 0; i< ulTabbeds.length; i++){
									var ulClass = ulTabbeds.eq(i).attr("class");
									if($(this).attr("class").indexOf(ulClass) != -1){
										ulTabbeds.eq(i).fadeIn(0);
										break;
									}
								}
							}
				}); 
				$('#slider').nivoSlider();
				//script chạy menu
				$("#h-menu li").hover(function(){
					$(this).children("ul").fadeIn(400);
				},function(){
					$(this).children("ul").fadeOut(400);
				});
				
				$("#langvi").click(function(){

					$.post(
							"<?php echo ROOT_PATH;?>/lang.php",
							{lang:0},
							function(data){
  								alert(data);

						 	});
				});

				$("#langen").click(function(){
					$.post("<?php echo ROOT_PATH;?>/lang.php",{lang:1},function(data)
							{
  								alert(data);

						 	});
			
				});
	});		
		
		</script>
        <style type="text/css">
		.field{
		width:100%;
		float:left;
		margin-top:5px;
		}
		.field span input
		{
			float:right;
			width:100px;
	    }
		</style>
	</head>
<body>
	<?php
	if(isset($_POST["login"]))
{
$username=$_POST["username"];
$password=$_POST["password"];
$st="select StudentID,StudentName from tblstudent where StudentCode='$username' and StudentPass=md5('$password')";
$kq=mysql_query($st);
$nr=mysql_num_rows($kq);
$row=mysql_fetch_assoc($kq);
if($nr>0)
{			
            $_SESSION["UserIDst"] = $row['StudentID'];	
			$_SESSION["User"] =$row['StudentName'];
}
}
 $st1="select * from weblink";
$kq1=mysql_query($st1);
?>
	<div id="header">
			<div id="h-top">
				<div id="logo"><a href="<?php echo ROOT_PATH;?>">
					<img src="<?php echo ROOT_PATH?>/images/logo.png" alt="logo" width="186" height="50"/></a>
				</div>
  				<ul id="h-menu">
  					<?php
					// lấy menu gốc
					$sqlRootMenus =sprintf("select * from tblmenu where parent_id = 0 order by tblmenu.order");
					$rootMenusResult= mysql_query($sqlRootMenus) or die(mysql_error());
					//cấp 1
					$i = 0;
					$arrRootMenus = array();
				 	while($row = mysql_fetch_object($rootMenusResult)){
				 		// luuw lại menu gốc cho footer;
				 		$arrRootMenus[] = $row;
				 		$i++;
						echo "<li ".(($i==mysql_num_rows($rootMenusResult)) ? "class='last'" : ""). "><a href='".ROOT_PATH.(($row->url =="") ? "/m/". $row->id : $row->url)."'>".(($lang == 0) ? $row->vi_name : $row->en_name)."</a>";
						$sqlChildMenus1 =sprintf("select * from tblmenu where parent_id = %s order by tblmenu.order", $row->id);
						$childMenusResult1= mysql_query($sqlChildMenus1) or die(mysql_error());
						if(mysql_num_rows($childMenusResult1) >0){
							echo "<ul>";
							//cấp 2
							while($row1 = mysql_fetch_object($childMenusResult1)){
								echo "<li><a href='".ROOT_PATH.(($row1->url =="") ? "/m/". $row1->id : $row1->url)."'>".(($lang == 0) ? $row1->vi_name : $row1->en_name)."</a>";
								$sqlChildMenus2 =sprintf("select * from tblmenu where parent_id = %s order by tblmenu.order", $row1->id);
								$childMenusResult2= mysql_query($sqlChildMenus2) or die(mysql_error());
								if(mysql_num_rows($childMenusResult2) >0){
									echo "<ul>";
									//cấp 3
									while($row2 = mysql_fetch_object($childMenusResult2)){
										echo "<li><a href='".ROOT_PATH.(($row2->url =="") ? "/m/". $row2->id : $row2->url)."'>".(($lang == 0) ? $row2->vi_name : $row2->en_name)."</a></li>";
									}
									echo "</ul>";
								}
								echo "</li>";
							}
							echo "</ul>";
						}
						echo "</li>";
					}
				?>
				</ul>
				
			</div><!-- end of sub.htmlh-top -->
			<div id="slider">
				<?php
					$sqlImages = "select link from tblhome_image";
					$rsImages = mysql_query($sqlImages) or die(mysql_error());
					while($image = mysql_fetch_object($rsImages)){
						echo "<img src='".$image->link."' alt=''/>"; 
					} 
				?>
			</div><!-- end of sub.htmlslide -->
			<div id="search">
					<div>
						<a href="#" id="langen">
							<img src="<?php echo ROOT_PATH?>/images/en.png" alt="English"/>
						</a>
						<a href="#" id="langvi">
							<img src="<?php echo ROOT_PATH?>/images/vi.png" alt="Vietnamese"/>
						</a>
					</div>
					<div>
						<form name="frmSearch" action="<?php echo ROOT_PATH?>/search" method="post">
							<input type="text" name="key" id="txtKeyWord" size="20"/>
							<input type="submit" id="btnSearch" value=""/>
						</form>
					</div>
							
				</div>
				<div id="login">
					<div class="l-top">

							<a href="#" onclick="showlogin()">Login</a>
							<a href="index.html">Site Map</a>
							<a href="#"><img src="<?php echo ROOT_PATH?>/images/mail.jpg" alt="Mail"/></a>
					</div>
                     <div id="showlogin">
						 <span style="height:30px;color:#00C;font-size:14px"><?php if($_SESSION["UserIDst"]!="") echo "<a href='".ROOT_PATH."/tnu/editinfo.php'>".$_SESSION["User"]."   |</a>  <a href='".ROOT_PATH."/tnu/logout.php'>đăng xuất</a>"; ?> </span>
                        
                     </div>

						<div class="l-bottom">
							<div class="a1">
							<a href="#"><?php echo ($lang==0)?"Liên kết website":"Website links";?></a>
							
							</div>
							<div class="a2">
							  <select onChange="window.open(this.value);">
                              <option>--Website liên kết--</option>
                             <?php
							  	
							  while($rowweb=mysql_fetch_array($kq1))
							 {
                              echo "<option value='".$rowweb["url"]."'>" .$rowweb["name"]."</option>";
							 }
							?>
                              </select>
							 
							</div>	

					
					
				</div>
			</div>
			
		</div>
